<template>
    <div>
        <el-container>
            <el-main>
                <el-container class="parent-body">
                    <el-header class="content-header">
                        添加会员类型
                        <div class="return-style"><el-button icon="el-icon-arrow-left" @click.native="returnButton">返回</el-button></div>
                    </el-header>
                    <el-main class="info-main">
                        <el-row>
                            <el-col style="height: 100%;" :span="8" :offset="6">
                                <el-form ref="form" :rules="rules" :model="form" label-width="150px">
                                    <el-form-item label="会员等级名称：" prop="msName">
                                        <el-input class="input-width" v-model="form.msName"></el-input>
                                    </el-form-item>
                                    <el-form-item label="成长值满足点：" prop="msGrowthvalue">
                                        <el-input class="input-width" v-model="form.msGrowthvalue"></el-input>
                                    </el-form-item>
                                    <el-form-item label="设为默认会员等级：">
                                        <el-radio-group v-model="form.msDefaultMember">
                                            <el-radio :label=0>否</el-radio>
                                            <el-radio :label=1>是</el-radio>
                                        </el-radio-group>
                                    </el-form-item>
                                    <el-form-item prop="msFreeshipping" label="免运费标准：">
                                        <el-input class="input-width" v-model="form.msFreeshipping"><templat slot="append">元/每笔</templat></el-input>
                                    </el-form-item>
                                    <el-form-item prop="msAward" label="奖励评价：">
                                        <el-input class="input-width" v-model="form.msAward"><templat slot="append">成长值/条</templat></el-input>
                                    </el-form-item>
                                    <el-form-item label="满免运费特权：">
                                        <el-switch  :active-value="1"
                                                   :inactive-value="0"
                                                  v-model="form.msPrivilegeShipping"></el-switch>
                                    </el-form-item>
                                    <el-form-item label="签到奖励特权：">
                                        <el-switch  :active-value="1"
                                                   :inactive-value="0" v-model="form.msPrivilegeSignin"></el-switch>
                                    </el-form-item>
                                    <el-form-item label="评价奖励特权：">
                                        <el-switch  :active-value="1"
                                                   :inactive-value="0" v-model="form.msPrivilegeEvaluate"></el-switch>
                                    </el-form-item>
                                    <el-form-item label="专享活动特权：">
                                        <el-switch  :active-value="1"
                                                   :inactive-value="0" v-model="form.msPrivilegeActivities"></el-switch>
                                    </el-form-item>
                                    <el-form-item label="会员特价特权：">
                                        <el-switch  :active-value="1"
                                                   :inactive-value="0" v-model="form.msPrivilegeSpecialoffer"></el-switch>
                                    </el-form-item>
                                    <el-form-item label="生日礼包特权：">
                                        <el-switch  :active-value="1"
                                                   :inactive-value="0" v-model="form.msPrivilegeBirthday"></el-switch>
                                    </el-form-item>
                                    <el-form-item>
                                        <el-button type="primary" @click="submitForm(form)">提交</el-button>
                                    </el-form-item>
                                </el-form>
                            </el-col>
                        </el-row>
                    </el-main>
                </el-container>
            </el-main>
        </el-container>
    </div>
</template>
<script>
import settingApi from "@/api/user/mbsetting";
    export default {
        data() {
            return {
                form:{
                    msName:'',
                    msGrowthvalue:'',
                    msDefaultMember:'',
                    msFreeshipping:'',
                    msAward:'',
                    msPrivilegeShipping:'',
                    msPrivilegeSignin:'',
                    msPrivilegeEvaluate:'',
                   msPrivilegeActivities:'',
                   msPrivilegeSpecialoffer:'',
                   msPrivilegeBirthday:'',
                },
                rules: {
                    name: [
                        {required: true, message: '请输入会员等级名称', trigger: 'blur'}
                    ],
                    name02: [
                        {required: true, message: '请输入成长值满足点', trigger: 'blur'}
                    ],
                    sort: [
                        {required: true, message: '请输入免运费标准', trigger: 'blur'}
                    ],
                    superiorClassify: [
                        {required: true, message: '请输入奖励评价', trigger: 'blur'}
                    ],
                }
            }
        },
        methods:{
            returnButton(){
                this.$router.replace({ path: "/user/memberSetting" });
            },
            submitForm(formName) {
               console.log(formName);
               settingApi.addList(formName).then(response =>{
                   console.log(response);
                     this.$router.push({path: "/user/memberSetting"});
               })
            },

        },
        mounted(){
          

        }
    }
</script>
<style scoped>
    .content-header{
        position: relative;
    }
    .return-style{
        position: absolute;
        right:10px;
    }
    .input-width{
        width:250px;
    }
</style>